
import 'package:flutterlib/common/constants/constants.dart';
import 'package:install_plugin/install_plugin.dart';

class VersionUtils {

  /// 应用安装
  static void install(String path) {
    // ChannelDataCenter().invokeMethod<void>('install', {'path': path});
    InstallPlugin.installApk(path, 'com.liveinstars.quhui')
        .then((result) {
      print('install apk $result');
    }).catchError((error) {
      print('install apk error: $error');
    });
      // url = url.isEmpty
      //     ? 'https://itunes.apple.com/cn/app/%E5%86%8D%E6%83%A0%E5%90%88%E4%BC%99%E4%BA%BA/id1375433239?l=zh&ls=1&mt=8'
      //     : url;
      // InstallPlugin.gotoAppStore(url);
  }

  /// AppStore跳转
  static void jumpAppStore() {
    // ChannelDataCenter().invokeMethod<void>('jumpAppStore', '');
    var url = 'https://itunes.apple.com/cn/app/%E5%86%8D%E6%83%A0%E5%90%88%E4%BC%99%E4%BA%BA/id1375433239?l=zh&ls=1&mt=8';

    InstallPlugin.gotoAppStore(url);
  }
}